
<template>
  <div class="items">{{ store.state.message }}</div>
</template>

<script>

import store from './store/index'; // 全局状态管理
import axios from 'axios'


export default {
  name: 'App',
  provide: {
    store,
  },

  setup() {
    const api = '/user/userinfo'
    axios.get(api).then((result) => {
      let data = result.data;
      store.setMessage(data.username + data.type)
    });

    const api2 = '/account?username=jiangzi&pwd=123456';
    axios.get(api2).then((result) => {
      let data = result.data;
      console.log('account', data);
    });

    const api3 = '/user/student';
    axios.get(api3).then((result) => {
      let data = result.data;
      console.log('student', data);
    })


    return {
      store
    }
  }
}

</script>
<style lang="" scoped>
  .items{
    text-align: left;
  }
  h4{
    display: inline-block;
    margin-left: 20px;
  }
</style>